home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-02-21 | 4.3 KB | 162 lines | [TEXT/MPCC] |
- //
- // File: MacFramework.h
- //
- // Contains: Basic functions for windows, menus, and similar things.
- //
- // Written by: Tim Monroe
- // Based (heavily!) on the MovieShell code written by Apple DTS
- //
- // Copyright: © 1994-1996 by Apple Computer, Inc., all rights reserved.
- //
- // Change History (most recent first):
- //
- // <3> 12/05/96 rtm added movie and instance to WindowObjectRecord
- // <2> 11/27/96 rtm conversion to personal coding style
- // <1> 12/20/94 khs first file
- //
-
- #pragma once
-
- // header files
-
- #include "QTVR.h"
- #include "Movies.h"
- #include <stdio.h>
- #include <TextUtils.h>
- #include <Memory.h>
-
- #ifdef __MWERKS__
- #include <sioux.h>
- #endif //__MWERKS__
-
-
- //////////
- // constants
- //////////
-
- enum {
- kMovieControllerObject = 'MCvr'
- };
-
-
- // for menus
- enum eMenubar {
- mMenubar = 128
- };
-
- enum eMainMenus {
- mApple = 128,
- mFile,
- mEdit
- };
-
- enum eAppleMenu {
- iAbout = 1
- };
-
- enum eFileMenu {
- iNew = 1,
- iOpen,
- iClose,
- iSave,
- iSaveAs,
- iPrint = 7,
- iQuit = 9
- };
-
- enum eEditMenu {
- iUndo = 1,
- iCut = 3,
- iCopy,
- iPaste,
- iClear,
- iSelectAll = 8
- };
-
- // for dialogs
- enum eDialogs {
- kAboutBox = 128,
- kAlertError = 129
- };
-
-
- //////////
- // structures
- //////////
-
- // WindowObjectRecord is a data structure attached to the movie window.
- // Use this structure to associate data with any window presented.
-
- typedef struct {
- WindowRef fWindow; // the window
- OSType fObjectType; // specific tag indicating that the window object belongs to our application
- Movie fMovie; // the main movie (QT or QTVR)
- MovieController fController; // the movie controller for this window
- Rect fOriginalSize; // original size of movie, including controller (currently unused)
- FSSpec fFileFSSpec;
- short fFileResID;
- short fFileRefNum;
- QTVRInstance fInstance; // the QTVRInstance
- Handle fAppData; // a handle to application-specific data
- } WindowObjectRecord, *WindowObjectPtr, **WindowObject;
-
-
- //////////
- // function prototypes
- //////////
-
- // Mac Toolbox functions
- void InitStack (long extraStackSpace);
- void InitMacEnvironment (long nMoreMasters);
- pascal void AppGrowZoneCallback (void);
-
- Boolean InitMenubar (void);
- void HandleMenuCommand (long theMenuResult);
- void AdjustMenus (void);
- Boolean CheckMovieControllers (EventRecord *theEvent);
- void MainEventLoop (void);
-
- Boolean IsAppWindow (WindowRef theWindow);
- WindowObject CreateWindowObject (WindowRef theWindow);
-
- void HandleKeyPress (EventRecord *theEvent);
- void ShowAboutDialogBox (void);
- void ShowWarning (Str255 theMessage, OSErr theErr);
-
- // movie-related Toolbox functions
- MovieController GetMCFromFrontWindow (void);
- Handle GetAppDataFromFrontWindow (void);
- Handle GetAppDataFromWindow (WindowRef theWindow);
- Handle GetAppDataFromWindowObject (WindowObject theWindowObject);
- Boolean IsWindowObjectOurs (WindowObject theObject);
- Boolean DoCreateNewMovie (void);
- MovieController SetupMovieWindowWithController (Movie theMovie, WindowRef theWindow);
- Boolean DoCreateMovieWindow (Movie theMovie);
- void DoDestroyMovieWindow (WindowRef theWindow);
- void DoActivateWindow (WindowRef theWindow, Boolean becomingActive);
- Boolean DoUpdateMovieFile (WindowRef theWindow);
-
-
- // application-specific functions
- // These are defined in the MacApplication.c file;
- // you could override these to change the behavior of the function in a specific application.
-
- void InitApplication (void);
- void StopApplication (void);
- void DoIdle (WindowRef theWindow);
- void DoUpdateWindow (WindowRef theWindow, Rect *theRefrehArea);
- void HandleContentClick (WindowRef theWindow, EventRecord *theEvent);
- Boolean HandleQTVRKeyPress (EventRecord *theEvent);
- WindowRef CreateMovieWindow (Rect *theRect, Str255 theTitle);
- void AddControllerFunctionality (MovieController theMC);
- void HandleApplicationMenu (short theMenuID, short theMenuItem);
- void AdjustApplicationMenus (void);
- WindowObject GetWindowObjectFromFrontWindow (void);
- QTVRInstance GetQTVRInstanceFromFrontWindow (void);
- void InitApplicationWindowObject (WindowObject theWindowObject);
- void RemoveApplicationWindowObject (WindowObject theWindowObject);
- pascal Boolean ApplicationMCActionFilterProc (MovieController theMC, short theAction, void *theParams, WindowRef theWindow);
-
-
-
-